import logging

# 创建log对象
log = logging.getLogger('Log')
# 日志打印到控制台
handler = logging.StreamHandler()
# 日志级别为debug
log.setLevel(logging.DEBUG)
# 定义日志格式
formatter = logging.Formatter('%(asctime)s %(name)s %(levelname)s %(message)s')
# 添加格式到handler
handler.setFormatter(formatter)
# 配置log对象
log.addHandler(handler)
